<%@ page language="java" import="java.util.*, java.text.*,com.zjut.zs.util.tools.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*,
com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*,com.zjut.zs.applyview.manager.*, com.zjut.zs.applyview.dao.*,
com.zjut.zs.userinfo.manager.*, com.zjut.zs.userinfo.dao.*,com.zjut.an.config.manager.*, com.zjut.an.config.dao.*,com.zjut.zs.school.manager.*, com.zjut.zs.school.dao.*,
com.zjut.zs.exampage.manager.*, com.zjut.zs.exampage.dao.*" pageEncoding="utf-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=Config.webname%></title>
	<link href="../plugins/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/css/style.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/css/plugins.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/css/themes/default.css" rel="stylesheet" type="text/css" id="style_color"/>
	<link href="../plugins/assets/css/custom.css" rel="stylesheet" type="text/css"/>
	<link rel="shortcut icon" href="favicon.ico" />
</head>
<style type="text/css">
		
		.bbtn
		{
			width:300px;
			height:80px;
			line-height:80px;
			text-align: center;
			font-weight: bold;
			font-size: 32px;
			color: #fff;			
			background: #529ecc;
			font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;
			margin:20px;
		}
    </style>
<%
if (session.getAttribute("zsUser") == null&&session.getAttribute("admin") == null&&session.getAttribute("user") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='main.jsp';</script>");
} else {
AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
ZsHTMLCreat html = (ZsHTMLCreat) SpringContextUtil.getBean("ZsHTMLCreat");
ZsSchoolManager smanager = (ZsSchoolManager) SpringContextUtil.getBean("ZsSchoolManager");
ZsUserStatusManager usmanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");
ZsUserinfoManager uimanager = (ZsUserinfoManager) SpringContextUtil.getBean("ZsUserinfoManager");
ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
ZsExamPageManager epmanager = (ZsExamPageManager) SpringContextUtil.getBean("ZsExamPageManager");
ZsApplyViewManager amanager = (ZsApplyViewManager) SpringContextUtil.getBean("ZsApplyViewManager");
StringUtil Stringutil = (StringUtil) SpringContextUtil.getBean("StringUtil");
ZsSchool school = new ZsSchool();
school = (ZsSchool)smanager.getDataByInstance(1,1,null,null,school).getObjects().get(0);

ZsUser user = null;
if(session.getAttribute("admin")!=null && request.getParameter("usId")!=null) {
	String usId = request.getParameter("usId");
	user = umanager.getData(usId);
} else if (session.getAttribute("zsUser")!=null) {
	user = (ZsUser)session.getAttribute("zsUser");	
} 

ZsUserinfo userinfo = new ZsUserinfo();
ZsExamPage exampage = new ZsExamPage();

ZsUserStatus userstatus = new ZsUserStatus();
if (user!=null) {
	userinfo.setZsUser(user);
	userinfo = (ZsUserinfo)uimanager.getDataByInstance(1,1,null,null,userinfo).getObjects().get(0);
	
	userstatus.setZsUser(user);
	userstatus = (ZsUserStatus)usmanager.getDataByInstance(1,1,null,null,userstatus).getObjects().get(0);
	if (null != userstatus.getExId()) {
		exampage = epmanager.getData(userstatus.getExId());
	}
}

ZsApplyView appview = amanager.getData(user.getUsId());
ZsApplyView topview = new ZsApplyView();
topview.setColumn1(appview.getColumn1());
topview.setTestNo("0");
List topviewlist = amanager.getDataByInstance(1,10000,"testNo", "asc", topview).getObjects();
%>

<body class="page-header-fixed">
<jsp:include page="systemrolevalidate.jsp" flush="true">
	<jsp:param name="m" value="userpower"/>
</jsp:include>
<div id="container" class="container" style="width:1000px;background:#fff;">
   	<div class="col-md-12">
		<div id="custom-toolbar">
		<%if (Status.LOCALSTATUS_YES.getStatus().equals(userstatus.getLocalStatus())){ %>
	    	<a href="#" class="btn default disabled bbtn">已经面试签到</a>
	    <%} else  if (Status.ON.getStatus().equals(school.getScLocalActive())){ %>
	    	<button class="btn btn-default bbtn" onclick="#" id="demo_3">确认面试签到</button>
	    <%} %>	    
	    </div>
    <%
    String content = exampage.getExContent().replace("$usName$", user.getUsName())
    		.replace("$usIdcard$", html.getInputString(appview.getUsIdcard()))
        	.replace("$usEmail$", html.getInputString(appview.getUsEmail()))
        	.replace("$usMobile$", html.getInputString(appview.getUsMobile()))
        	.replace("$testNo$", html.getInputString(appview.getTestNo()))
        	.replace("$column1$", html.getInputString(appview.getColumn1()))
        	.replace("$column2$", html.getInputString(appview.getColumn2()))
        	.replace("$column3$", html.getInputString(appview.getColumn3()))
        	.replace("$column4$", html.getInputString(appview.getColumn4()))
        	.replace("$column5$", html.getInputString(appview.getColumn5()))
        	.replace("$column6$", html.getInputString(appview.getColumn6()))
        	.replace("$column7$", html.getInputString(appview.getColumn7()))
        	.replace("$column8$", html.getInputString(appview.getColumn8()))
        	.replace("$column9$", html.getInputString(appview.getColumn9()))
        	.replace("$column10$", html.getInputString(appview.getColumn10()))
        	.replace("$inZydm01$", html.getInputString(appview.getInZydm01()))
        	.replace("$inZydm02$", html.getInputString(appview.getInZydm02()))
        	.replace("$inZydm03$", html.getInputString(appview.getInZydm03()))
        	.replace("$inZydm04$", html.getInputString(appview.getInZydm04()))
        	.replace("$inZydm05$", html.getInputString(appview.getInZydm05()))
        	.replace("$inZydm06$", html.getInputString(appview.getInZydm06()))
        	.replace("$inZydm07$", html.getInputString(appview.getInZydm07()))
        	.replace("$inZydm08$", html.getInputString(appview.getInZydm08()))
        	.replace("$inZydm09$", html.getInputString(appview.getInZydm09()))
        	.replace("$inZydm10$", html.getInputString(appview.getInZydm10()))
        	.replace("$inZymc01$", html.getInputString(appview.getInZymc01()))
        	.replace("$inZymc02$", html.getInputString(appview.getInZymc02()))
        	.replace("$inZymc03$", html.getInputString(appview.getInZymc03()))
        	.replace("$inZymc04$", html.getInputString(appview.getInZymc04()))
        	.replace("$inZymc05$", html.getInputString(appview.getInZymc05()))
        	.replace("$inZymc06$", html.getInputString(appview.getInZymc06()))
        	.replace("$inZymc07$", html.getInputString(appview.getInZymc07()))
        	.replace("$inZymc08$", html.getInputString(appview.getInZymc08()))
        	.replace("$inZymc09$", html.getInputString(appview.getInZymc09()))
        	.replace("$inZymc10$", html.getInputString(appview.getInZymc10()))
        	.replace("$scColumn1$", html.getInputString(appview.getScColumn1()))
        	.replace("$scColumn2$", html.getInputString(appview.getScColumn2()))
        	.replace("$scColumn3$", html.getInputString(appview.getScColumn3()))
        	.replace("$scColumn4$", html.getInputString(appview.getScColumn4()))
        	.replace("$scColumn5$", html.getInputString(appview.getScColumn5()))
        	.replace("$scColumn6$", html.getInputString(appview.getScColumn6()))
        	.replace("$scColumn7$", html.getInputString(appview.getScColumn7()))
        	.replace("$scColumn8$", html.getInputString(appview.getScColumn8()))
        	.replace("$scColumn9$", html.getInputString(appview.getScColumn9()))
        	.replace("$scColumn10$", html.getInputString(appview.getScColumn10()))
        	.replace("$inXb$", html.getInputString(appview.getInXb()))
        	.replace("$inMz$", html.getInputString(appview.getInMz()))
        	.replace("$inZzmm$", html.getInputString(appview.getInZzmm()))
        	.replace("$usBmxh$", html.getInputString(appview.getUsBmxh())) 
        	.replace("$inKslb$", html.getInputString(appview.getInKslb()))
        	.replace("$inLxdh2$", html.getInputString(appview.getInLxdh2()))
        	.replace("$inByxxmc$", html.getInputString(appview.getInByxxmc()))
        	.replace("$testNoOrder$", html.getInputString(appview.getInPinying()))
        	.replace("$receiveno$", user.getUsNo());
	content = content.replace("src=\"inPhoto\"", "src='../photo/"+html.getInputString(user.getUsIdcard())+".jpg' "); 
    out.print(content);
    %>
	</div>

	<script src="../plugins/assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
	<script src="../plugins/assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>    
	<script src="../plugins/assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
	<script src="../plugins/assets/plugins/bootstrap-hover-dropdown/twitter-bootstrap-hover-dropdown.min.js" type="text/javascript" ></script>
	<script src="../plugins/assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
	<script src="../plugins/assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>  
	<script src="../plugins/assets/plugins/jquery.cookie.min.js" type="text/javascript"></script>
	<script src="../plugins/assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript" ></script>
	
	
	<script src="../plugins/bootstrap-table-master/bootstrap-table.min.js"></script>
	<script src="../plugins/bootstrap-table-master/locale/bootstrap-table-zh-CN.min.js"></script>
	<!-- BEGIN PAGE LEVEL PLUGINS -->
	<script src="../plugins/assets/plugins/bootbox/bootbox.min.js" type="text/javascript" ></script>
	<!-- END PAGE LEVEL PLUGINS -->
	<!-- BEGIN PAGE LEVEL SCRIPTS -->
	<script src="../plugins/assets/scripts/app.js"></script>
	
	<script>
		jQuery(document).ready(function() {       
		   App.init();
		   UIBootbox.init();
		});
		
		function localStatus(){
			$.ajax({
			    cache: false,
			    type: "POST",
			    url:'../zsUserStatusLocal.action?localStatusType=single&ussId=<%=userstatus.getUssId()%>',
			    dataType:"html",
			    async: false,
			    error: function(request) {
			    	alert("设置签到有误");
			    },
			    success: function(data) {///成功跳转
				    window.location = 'zsApplyViewStatus.jsp?usId=<%=user.getUsId()%>'; ///当用ajax访问 时候成功的时候就自动的跳转过去
	            }
			});
		}
		
		
		var UIBootbox = function () {
		    return {		
		        //main function to initiate the module
		        init: function () {
		            $('#demo_3').click(function(){
		                bootbox.confirm("确认进行面试签到吗?", function(result) {
		                	if (result) {
		                    	localStatus();                	
		                	}
		                }); 
		            });
		            //end #demo_3	
		        }
		    };		
		}();

		$("#ewcode1").attr("src","https://sapi.k780.com/?app=qr.get&data=<%=anconfig.getSingleConfigInfoByName("网站域名") %>/admin/zsApplyViewStatus.jsp?usId=<%=user.getUsId()%>&level=L&size=6&localStatusType=single"); 
		$("#ewcode2").attr("src","https://sapi.k780.com/?app=qr.get&data=<%=anconfig.getSingleConfigInfoByName("网站域名") %>/admin/zsApplyViewEdit.jsp?usId=<%=user.getUsId()%>&level=L&size=6"); 

</script>
</body>
<%} %>

</html>